/*count number of characters, words and lines*/
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
void main()
{
___int a;/* charecter value var */
___int x=0;/* number of charecters */
___int y=0;/* number of lines */
___int z=0;/* number of words */
___clrscr();/* clear screen */
___printf("Enter charecters line =>\n");/* print invitation */
___a=getchar();/* get first charecters */
___while(a != EOF)/* check for End Of File */
___{
______while(a!='\n')/* check for the next line char */
______{
_________while(isspace(a) && a!='\n')/* check for space char but not new line char */
____________a=getchar();/* get next charecter */
_________while(isalnum(a) || ispunct(a))/* check for leter, number or punctuation */
_________{
____________while(isalnum(a) || ispunct(a)) /* check for leter, number or punctuation */
____________{
_______________x=x+1;/* count the charecters */
_______________a=getchar();/* get next charecter */
____________}
____________z=z+1;/* count the words */
_________}
______}
______y=y+1;/* count the lines */
______a=getchar();/* get next char */
___}
___printf("char=%i words=%i lines=%i",x,z,y);/*print answer */
}